from pyfbsdk import *
lModels = FBModelList()
FBGetSelectedModels(lModels)
lProperty = (('My Integer ', FBPropertyType.kFBPT_int, 'Integer', True, True, None),
('My Bool ', FBPropertyType.kFBPT_bool, 'Bool', True, True, None),
('My Float ', FBPropertyType.kFBPT_float, 'Float', False, True, None),
('My Double ', FBPropertyType.kFBPT_double, 'Number',True, True, None),
('My Chrptr ', FBPropertyType.kFBPT_charptr, 'String', False, True, None),
('My Enum ', FBPropertyType.kFBPT_enum, 'Enum', True, True, None),
('My Time', FBPropertyType.kFBPT_Time, 'Time', True, True, None),
('My Obj', FBPropertyType.kFBPT_object, 'Object', False, True, None ),
('My Stringlist', FBPropertyType.kFBPT_stringlist, 'StringList', False, True, None),
('My Vector4D ', FBPropertyType.kFBPT_Vector4D, 'Vector', True, True, None),
('My Vector3D ', FBPropertyType.kFBPT_Vector3D, 'Vector', True, True, None),
('My Vector2D ', FBPropertyType.kFBPT_Vector2D, 'Vector', True, True, None),
('My Colour ', FBPropertyType.kFBPT_ColorRGB, 'Color', True, True, None),
('My ColourAndAlpha ', FBPropertyType.kFBPT_ColorRGBA, 'ColorAndAlpha', True, True, None),
('My Action ', FBPropertyType.kFBPT_Action, 'Action', True, True, None),
('My TimeSpan', FBPropertyType.kFBPT_TimeSpan, 'Time', False, True, None),
)
if len( lModels ) == 0:
FBMessageBox( "Message", "Nothing selected", "OK", None, None )
else:
lFbp = FBProgress()
lFbp.Caption = "CREATING CUSTOM PROPERTIES"
lFbp.Text = "yay !"
lCount = 0.0
for x in lModels:
for ( pName, pType, pDataType,pAnimatable, pIsUser, pReferenceSource ) in lProperty:
prop = x.PropertyCreate( pName, pType, pDataType, pAnimatable, pIsUser, pReferenceSource )
if prop == None:
print "NoneObj:"+pName+","+str(pType)
else:
print prop.GetName()+prop.GetPropertyTypeName()
lProp = x.PropertyList.Find('My Integer ')
lProp.SetMin(-100)
lProp.SetMax(100)
lProp.Data = 10
lProp.SetAnimated(True)
lProp = x.PropertyList.Find('My Bool ')
lProp.Data = False
lProp.SetAnimated(True)
lProp = x.PropertyList.Find('My Double ')
lProp.SetMin(-100)
lProp.SetMax(100)
lProp.Data = 2.2
lProp.SetAnimated(True)
lProp= x.PropertyList.Find('My ChrPtr ')
lProp.Data = "TestThis!"
lProp = x.PropertyList.Find('My Colour ')
lColour = FBColor(0,0,1)
lProp.Data = lColour
lProp.SetAnimated(True)
lProp = x.PropertyList.Find('My ColourAndAlpha ')
lColour = FBColorAndAlpha(0,1,0,0.5)
lProp.SetAnimated(True)
lProp = x.PropertyList.Find('My Action ')
lProp.SetAnimated(True)
lProp = x.PropertyList.Find('My Bool ')
lProp.Data = True
lProp.SetAnimated(True)
lProp = x.PropertyList.Find('My Integer ')
lProp.SetMin(0)
lProp.SetMax(100)
lProp.Data = 0
lProp.SetAnimated(True)
lCount += 1
lVal = lCount / len(lModels) * 100
lFbp.Percent = int(lVal)
lFbp.FBDelete()